package com.itheima.mapper;

import com.itheima.pojo.Dept;
import com.itheima.pojo.Emp;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface DeptMapper {

    @Select("select * from dept")
    List<Dept> listdept();

    /**
     * 删除部门
     */
    @Delete("delete from dept where id = #{id}")
    void deldteDept(Integer id);

    /**
     * 新增部门信息
     * @param dept
     */
    @Insert("insert into dept (name, create_time, update_time) values (#{name},#{createTime},#{updateTime})")
    void insertDept(Dept dept);




    /**
     * 根据Id查询
     * @param id
     */
    @Select("select * from dept where id = #{id}")
    Dept listByid(Integer id);

    @Update("update dept set name=#{name},create_time = #{createTime}, update_time = #{updateTime} where id = #{id}")
    void updateDept(Dept dept);

    // @Update("update dept set name=#{name},create_time = #{createTime}, update_time = #{updateTime} where id = #{id}")
    // Dept updateDept(Dept dept);
}
